-
-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Small SAST fixes #8534
Small SAST fixes #8534
Conversation
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8534 +/- ##
==========================================
- Coverage 84.52% 84.51% -0.01%
==========================================
Files 1178 1178
Lines 53709 53582 -127
Branches 2028 2027 -1
==========================================
- Hits 45396 45285 -111
+ Misses 7806 7790 -16
Partials 507 507
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -81,6 +80,7 @@ export default function ImporterDrawer({ | |||
return 3; | |||
case importSessionStatus.COMPLETE: | |||
return 4; | |||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'default' case should return a value here still, otherwise you are changing functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? default
is empty in the current code base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scratch that
@@ -84,7 +84,7 @@ export const getPluginTemplateEditor = ( | |||
useEffect(() => { | |||
(async () => { | |||
try { | |||
await func({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the await needed here so that asynchronous errors are catched too? But not sure about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't func
be marked async for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be asynchronous if
https://github.com/inventree/InvenTree/blob/master/src/frontend/src/components/plugins/PluginUIFeatureTypes.ts#L1is defined as a promise by the individual feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you’re right, in this case it can’t be async, so its fine removing it. Good catch.
Or we could define it as void | Promise<void>
instead of undefined in the Template editor feature, and use await Promise.resolve(func)…
then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH all of those were caught by SonarCloud and were marked as middle to high importance so I mainly fixed them to get the quality gate back to good-ish before the release
Thanks @matmair |
No description provided.